<!DOCTYPE html>
<html>
<head>
    <title>CityPickerDemo</title>
    <meta charset="UTF-8">
    <!-- 引入jQuery -->
    <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <!-- Demo所使用的样式表 -->
    <link rel="stylesheet" type="text/css" href="style.css?v=1">
    <!-- 使用select生成的插件 -->
    <script type="text/javascript" src="src/city-picker.js"></script>
</head>
<body>
<div id="main">
    <div id="container">
        <form method="post">
            <ul>
                <li class="item">
                    <div class="box">
                        <h3>Select原生CityPicker</h3>
                    </div>
                </li>
                <li class="item">
                    <div class="box">
                        <div>
                            <select id="select_province"></select>
                        </div>
                        <div>
                            <select id="select_city"></select>
                        </div>
                        <div>
                            <select id="select_area"></select>
                        </div>
                        <div id="select_result"></div>
                    </div>
                </li>
            </ul>
        </form>
    </div>
</div>

<script type="text/javascript">
$(function() {

    // 使用select标签生成的插件
    $.fn.cityPicker({
        province: '#select_province',
        city: '#select_city',
        area: '#select_area',
        onSelected: function(province, city, area) {
            if ($.inArray(province, ['北京市', '上海市', '天津市', '重庆市']) != -1) {
                var _html = province + '-' + area;
            } else {
                var _html = province + '-' + city + '-' + area;
            }
            $('#select_result').html(_html);
        }
    });

});
</script>
</body>
</html>